import request from '@/utils/request'

export function getList(params) {
  return request({
    url: '/vue-admin-template/role/list',
    method: 'get',
    params
  })
}

// 新增角色
export function roleAdd(data) {
  return request({
    url: '/system/role',
    method: 'post',
    data,
  })
}
// 删除角色
export function roleDelete(roleId) {
  return request({
    url: '/system/role/' + roleId,
    method: 'delete'
  })
}
// 修改保存角色
export function roleEdit(data) {
  return request({
    url: '/system/role',
    method: 'put',
    data,
  })
}
// 根据角色编号获取详细信息
export function roleDetail(id) {
  return request({
    url: '/system/role/'+id,
    method: 'get'
  })
}
// 角色列表
export function roleList(params) {
  return request({
    url: '/system/role/list',
    method: 'get',
    params
  })
}

// 查询已分配用户角色列表
export function allocatedListUsingGET(data) {
  return request({
    url: '/system/role/allocatedList',
    method: 'get',
    data
  })
}
// 取消授权用户
export function cancelAuthUserUsingPUT(data) {
  return request({
    url: '/system/role/cancelAuthUser',
    method: 'put',
    data
  })
}
// 批量取消授权用户
export function cancelAuthUserAllUsingPUT(data) {
  return request({
    url: '/system/role/cancelAuthUserAll',
    method: 'put',
    data
  })
}
// 批量选择用户授权
export function selectAuthUserAllUsingPUT(data) {
  return request({
    url: '/system/role/selectAuthUserAll',
    method: 'put',
    data
  })
}
// 查询未分配用户角色列表
export function unallocatedListUsingGET(data) {
  return request({
    url: '/system/role/unallocatedList',
    method: 'get',
    data
  })
}
// 状态修改
export function changeStatusUsingPUT(data) {
  return request({
    url: '/system/role/changeStatus',
    method: 'put',
    data
  })
}
// 修改保存数据权限
export function dataScopeUsingPUT(data) {
  return request({
    url: '/system/role/dataScope',
    method: 'put',
    data
  })
}
// 角色导出
export function exportUsingGET(data) {
  return request({
    url: '/system/role/export',
    method: 'get',
    data
  })
}
// 获取角色选择框列表
export function optionselectUsingGET(data) {
  return request({
    url: '/system/role/optionselect',
    method: 'get',
    data
  })
}
